package com.company.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.company.project.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 用户 Mapper
 *
 * @author wenbin
 * @version V1.0
 * @date 2020年3月18日
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select count(1) from t_seats where accountid = #{sysUser.id}\n" +
            "        and dqtime > now()")
    Integer selectIsStatus(@Param("sysUser") SysUser sysUser);

    @Update("update sys_user_role set role_id = #{role} where user_id = #{sysUser.id}")
    void updateUserRole(@Param("role") String role,@Param("sysUser") SysUser sysUser);
}